#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QStandardItemModel>
#include <qwt_plot_curve.h>
#include "connection.h"
#define HISTORY 60

namespace Ui {
    class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
    Connection *m_connection;
    bool m_newList;//display process
    static int interval;
    void connectToServer();
    void displayProcess(QStringList);
    void displayCpu(QStringList);
    void displayEth(QStringList);
    void displayMem(QStringList);
    void displayAvg(QStringList);
    void displayHw(QStringList);
    void displayVer(QStringList);
    void displayHost(QStringList);
    QStandardItemModel *process_model;

    QwtPlotCurve *cpu_curve;
    double x[HISTORY];
    double y[HISTORY+1];


private slots:
    void readServerData();//xzx
    void on_connectPushButton_released();
    void on_closeConnectPushButton_released();
    void parseMsg(QString msg);
    void connected();
    void closeConnection();
};

#endif // MAINWINDOW_H
